package com.ninth_group.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ninth_group.result.R;
import com.ninth_group.service.PawService;
import com.ninth_group.vo.CityVO;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 省会天气, 返回CityVo
 */
@RestController
@RequestMapping("/paw")
public class PawController {
    @Resource
    private PawService paw;

    @GetMapping("/{pName}")
    public R getPiwData(@PathVariable String pName) throws JsonProcessingException {
        CityVO cityVO = paw.getPawData(pName);
        return R.ok("success", cityVO);
    }
}
